﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using EasySamba.Models;
using Microsoft.AspNetCore.Authorization;

namespace EasySamba.Controllers
{
    [Authorize]
    public class ProfessionalController : Controller
    {
        public IActionResult Index()
        {
            var result = Comn.LoadConfigContent();
            return View(new ProfessionalViewModel { ConfigContent = result.Success ? string.Join(Environment.NewLine, result.Data) : result .Massage});
        }

        [HttpPost]
        public JsonResult SaveConfig(string password, string configContent)
        {
            var result = Comn.SaveConfigContent(password, configContent);
            return Json(result);
        }
    }
}
